
Button.addEventListener("click", a);
function a() {
    var str = "异步函数";
    var i=0;
    alert("成功调用a函数" + "str=" + str + "5秒钟之后自动调用B函数.");
    var interval = setInterval(function () {
        i++;
        if(i == 5){
            str = "异步函数顺序调用";
            clearInterval(interval);
            setTimeout( b(str), 1000);
        }
    }, 1000);
    return str;
}

function b(str) {
    alert("已经成功调用b函数"+"str=" + str);
}